package com.chen.spring.cloud.service.coupon.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chen.entity.Coupon;
import com.chen.spring.cloud.service.coupon.mapper.CouponMapper;
import com.chen.spring.cloud.service.coupon.service.ICouponService;
import com.chen.vo.MyCouponVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 优惠券 服务实现类
 * </p>
 *
 * @author 陈永鹏
 * @since 2019-03-26
 */
@Service
public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> implements ICouponService {

    @Autowired
    private CouponMapper couponMapper;

    @Override
    public List<MyCouponVo> MyCoupons(int u_id,int start,int end) {
        Map<String,Integer> parms = new HashMap<>();
        parms.put("u_id",u_id);
        parms.put("start",start);
        parms.put("end",end);
        return couponMapper.myCoupons(parms);
    }

    @Override
    public int getMyCouponCount(int u_id) {
        return couponMapper.getMyCouponCount(u_id);
    }
}
